summaryrefslogtreecommitdiff
path: root/src/pages/blog/[...slug].astro
diff options
context:
space:
mode:
authorhouston[bot] <astrobot-houston@users.noreply.github.com>2025-10-19 18:30:51 +0200
committerMatthieu Pignolet <matthieu@puffer.fish>2025-10-19 18:30:51 +0200
commite435718c4dd6e956dc1748689a6156129650c250 (patch)
tree575ab9929930553253b9cf0a8b8843d48d7e6867 /src/pages/blog/[...slug].astro
Initial commit from Astro
Diffstat (limited to 'src/pages/blog/[...slug].astro')
-rw-r--r--src/pages/blog/[...slug].astro20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/pages/blog/[...slug].astro b/src/pages/blog/[...slug].astro
new file mode 100644
index 0000000..0754ea7
--- /dev/null
+++ b/src/pages/blog/[...slug].astro
@@ -0,0 +1,20 @@
+---
+import { type CollectionEntry, getCollection, render } from 'astro:content';
+import BlogPost from '../../layouts/BlogPost.astro';
+
+export async function getStaticPaths() {
+ const posts = await getCollection('blog');
+ return posts.map((post) => ({
+ params: { slug: post.id },
+ props: post,
+ }));
+}
+type Props = CollectionEntry<'blog'>;
+
+const post = Astro.props;
+const { Content } = await render(post);
+---
+
+<BlogPost {...post.data}>
+ <Content />
+</BlogPost>